package com.hwadee.caixiang.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hwadee.caixiang.dao.LoginMapper;
import com.hwadee.caixiang.entity.User;
import com.hwadee.caixiang.service.LoginService;

@Service("loginService")
public class LoginServiceImpl implements LoginService {
	@Autowired
	private LoginMapper loginMapper;

	@Override
	public User login(String username, String password) {

		User user = loginMapper.findUserByUsername(username);
		if (null == user || !password.equals(user.getPassword())) {
			// throw new RuntimeException("用户名或密码错误!");
			return null;
		} else
			return user;
	}
}
